from PySide6.QtCore import QObject


class ScriptClass(QObject):
    mainObj: QObject = None
    typeCount = 2

    def __init__(self, newObj):
        super().__init__()
        self.mainObj = newObj

    def InItMainAll(self, runTimesCount):
        if runTimesCount % self.typeCount == 0:
            self.InItMainObj()
            self.InItMainData01()
        else:
            self.InItMainObj()
            self.InItMainData02()

    def InItMainObj(self):
        self.mainObj.checkBoxEngineerMode.setChecked(False)
        self.mainObj.checkBoxTpIntSelect.setChecked(False)
        self.mainObj.checkBoxSendDataSelect.setChecked(True)
        self.mainObj.checkBoxIntDHUSelect.setChecked(False)
        self.mainObj.checkBoxDelayTimeSelect.setChecked(True)
        self.mainObj.checkBoxHUReadSelect.setChecked(True)
        self.mainObj.checkBoxMCUGPIOSelect.setChecked(False)

    def InItMainData01(self):
        self.mainObj.textBrowser.setText("开背光")
        self.mainObj.plainTextEditSendData.setPlainText("04 01 01")
        self.mainObj.spinBoxDelayTime.setValue(10)
        self.mainObj.lineEditDataAddr.setText("0x04")
        self.mainObj.spinBoxReadLen.setValue(2)

    def InItMainData02(self):
        self.mainObj.textBrowser.setText("关背光")
        self.mainObj.plainTextEditSendData.setPlainText("04 01 00")
        self.mainObj.spinBoxDelayTime.setValue(10)
        self.mainObj.lineEditDataAddr.setText("0x04")
        self.mainObj.spinBoxReadLen.setValue(3)
